class Solution
{
public:
    string printBin(double num)
    {
        string result = "0.";
        while (true)
        {
            num *= 2.0;
            if (num >= 1.0)
            {
                result += '1';
                num -= 1.0;
            }
            else
            {
                result += '0';
            }
            if (num == 0.0)
            {
                break;
            }
            else if (result.size() == 32)
            {
                return "ERROR";
            }
        }
        return result;
    }
};